home *** CD-ROM | disk | FTP | other *** search
/ Directorty Opus 5 - Magellan 2 / Opus 5 - Magellan 2.iso / Extras / DOpus-1541 / REXX / DOPUS / 1541 / 1541Cmd.rexx next >
OS/2 REXX Batch file  |  1995-02-24  |  2KB  |  76 lines

  1. /*
  2.  *
  3.  * Execute a 1541 drive command from DOpus.
  4.  *
  5.  * (c) 1995 by Christer Bjarnemo  mr.bjarnemo@mn.medstroms.se
  6.  *
  7.  * Based on Twin-Dopus by Patrick Van Beem (patrick.van.beem@aobh.xs4all.nl),
  8.  * which based he's script on the DOpusLhaARexx package by Geoff Seeley.
  9.  *
  10.  */
  11.  
  12. dircmd = "Work:Emulators/A64/Utils/"    /* Note. If the file ENVARC:1541.PREFS */
  13. rxdir =  "Rexx:Dopus/1541/"             /* exists, that one will override the  */
  14. tmpdir = "t:"                           /* settings here...                    */
  15. DOpusPort   = 'DOPUS.1'
  16.  
  17. snuff = '22'x
  18.  
  19. if open(1,'env:1541.prefs','Read') then do
  20.         dircmd = readln(1)
  21.     rxdir  = readln(1)
  22.         tmpdir = readln(1)
  23.     address command 'type 'tmpdir'_64dir.tmp'
  24.         end
  25. close(1)
  26.  
  27. dircmd = slashpath(dircmd)
  28. rxdir =  slashpath(rxdir)
  29. tmpdir = slashpath(tmpdir)
  30.  
  31.  
  32. if ~show(l,"rexxsupport.library") then        
  33.     call addlib("rexxsupport.library",0,-30,0)
  34. if showlist('Ports', DOpusPort) = 0 then do
  35.    say 'Directory Opus Arexx port not found. Aborting.'
  36.    call CleanUp
  37. end
  38.  
  39. address(DOpusPort)
  40. options results
  41.  
  42. /* setup DOpus window and tell user what's happening */
  43. Busy on
  44. TopText "Execute 1541-command..."
  45.  
  46. Getstring '"Enter a 1541 command (for example: i = initialize, v = validate)" ""'
  47. cmd = result
  48.  
  49. if cmd = '' | cmd = 0 then call cleanup
  50.  
  51. address command dircmd'64Cmd >'tmpdir'1541.tmp "'cmd'" 8'
  52.  
  53. if open(1,tmpdir'1541.tmp','Read') then do
  54.         Do for 8 ; tmp = readln(1) ; End
  55.     say tmp
  56.     Toptext tmp
  57.         close(1)
  58.         end
  59. exit
  60.  
  61. /*---------------------------------------------------------------------------*/
  62. Slashpath: procedure /* Put a (/) or (:) at the end of filenames (if neccessary) */
  63. parse arg string
  64.     if right(string,1) ~= ':' & right(string,1) ~= '/'  then do
  65.         string = string'/'
  66.         end
  67. return string
  68.  
  69.  
  70. /*---------------------------------------------------------------------------*/
  71.  
  72. CleanUp: /* Remove any files and exit */
  73.    Busy off
  74.    exit
  75. return
  76.